// app/service/user.js
const Service = require('egg').Service;

class LiveService extends Service {
//   async find(uid) {
//     const user = await this.ctx.db.query(
//       'select * from user where uid = ?',
//       uid,
//     );
//     return user;
//   }

  // 获取房源列表
  async getLiveList() {
    let sql = `select * from live`;
    const res = await this.ctx.app.mysql.query(sql, []);
    if (res.length > 0) {
      return {
        status: true,
        code: 200,
        message: '获取直播列表成功',
        data: res
      }
    } else {
      return {
        status: false,
        code: 403,
        message: '获取直播列表失败',
        data: []
      }
    }
  }
  

}

module.exports = LiveService;